Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update devp2p API names and access specifiers #2889

Merged
merged 25 commits into from
Jul 17, 2023

Conversation

scorbajio
Copy link
Contributor

@scorbajio scorbajio commented Jul 13, 2023

This PR addresses part of #2872 by renaming and rethinking access specifiers for properties of devp2p package classes.

@scorbajio scorbajio linked an issue Jul 13, 2023 that may be closed by this pull request
2 tasks
@scorbajio scorbajio removed a link to an issue Jul 13, 2023
2 tasks
@codecov
Copy link

codecov bot commented Jul 13, 2023

Codecov Report

Merging #2889 (9cfb5b8) into master (47714a6) will increase coverage by 0.50%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 88.62% <ø> (ø)
blockchain 92.58% <ø> (?)
client 87.18% <100.00%> (-0.02%) ⬇️
common 97.13% <ø> (ø)
ethash ∅ <ø> (∅)
evm 69.62% <ø> (ø)
rlp ∅ <ø> (?)
statemanager 85.16% <ø> (ø)
trie 90.04% <ø> (ø)
tx 95.96% <ø> (ø)
util 87.14% <ø> (ø)
vm 77.87% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super cool, going in a good direction 👍 and this will so dramatically improve the API (e.g. for code completion) of this package 🙏, phew, wasn’t aware that there are SO many properties floating around. 😅

Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏 🙏 🙏

Absolutely love this! 😍

Super clean and consistent, thanks a lot for this straight forward tackling!

Will merge.

packages/devp2p/src/dns/dns.ts Show resolved Hide resolved
packages/devp2p/src/dpt/ban-list.ts Show resolved Hide resolved
protected _requests: Map<string, any>
protected _requestsCache: LRUCache<string, Promise<any>>
protected _socket: DgramSocket | null
private _debug: Debugger
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely not practically relevant and only a small nit, but I would think that it would make sense to just not distinguish between "even more internal" or so variables and just also make _debug protected, maybe someone wants to customize the devp2p package and add own debug messages, whatever.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was on the fence about this one, but since debuggers are usually initialized specific to a class, I opted for private.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The protected version is also remaining in the class scope, so this is just a bit broader so that people can e.g. subclass the Server class, e.g. for a custom binance devp2p implementation (super random example) or whatever. And then on the subclass one might want to adjust some properties and it is just a bit unlucky if these are then not accessible. So at some point in time [tm] we generally decided to favor protected over private, since it (more or less) achieves the same thing and has fewer side effects.

@holgerd77 holgerd77 merged commit 0af7309 into master Jul 17, 2023
@holgerd77 holgerd77 deleted the devp2p-fields-access-and-naming-cleanup branch July 17, 2023 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants